<template>
    <div class="activation">
        <div class="activationCon">
            <div class="bgDiv">
                <div class="leftCon">
                    <div class="leftCon_title">
                        <div></div>
                        <div>学生激活</div>
                        <div>
                            已有账号？
                            <span @click="$router.push('/login')">快速登录</span>
                        </div>
                    </div>
                    <div class="leftCon_steps">
                        <Steps :current="isShow">
                            <Step title="激活信息"></Step>
                            <Step title="确认信息"></Step>
                            <Step title="完善信息"></Step>
                            <Step title="激活完成"></Step>
                        </Steps>
                    </div>
                    <div class="leftCon_content">
                        <div v-if="isShow == 0" class="leftCon_contentDiv">
                            <Form :model="form" :rules="rulesForm" label-position="right" ref="form" :label-width="100">
                                <FormItem label="所属学校" prop="school">
                                    <Select placeholder="请选择所属学校" v-model="form.school" filterable>
                                        <Option v-for="item in schoolList" :value="item.code" :key="item.value">{{ item.name }}</Option>
                                    </Select>
                                </FormItem>
                                <FormItem label="毕业年度" prop="bynx">
                                    <DatePicker v-model="form.bynx" type="year" format="yyyy" clearable placeholder="选择毕业年度" style="width: 100%" @on-change="datapick"></DatePicker>
                                    <!--                  <Select placeholder="请选择毕业年度" v-model="form.bynx">-->
                                    <!--                    <Option v-for="(item,i) in bynxList" :value="item" :key="i">{{ item }}届</Option>-->
                                    <!--                  </Select>-->
                                </FormItem>
                                <FormItem label="身份证号" prop="idCard">
                                    <Input v-model="form.idCard" size="large" clearable placeholder="请输入您的身份证号" autocomplete="off" />
                                </FormItem>

                                <!--                可滑动验证码-->

                                <FormItem label="手机号" prop="mobile" :error="errorMobile">
                                    <Input v-model="form.mobile" size="large" clearable placeholder="请输入您的手机号" autocomplete="off" />
                                </FormItem>
                                <!--

                  <Row style="display: flex;justify-content: space-between">-->
                                <Row>
                                    <FormItem label="验证码" prop="code">
                                        <Input v-model="form.code" size="large" clearable placeholder="请输入短信验证码" :maxlength="10" class="input-verify" />
                                    </FormItem>

                                    <CountDownButton ref="countDown" @on-click="showVaptcha" :autoCountDown="false" size="large" :loading="sending" :text="getSms" />
                                    <slidingVerification ref="slidingv" @onOk="onOk" :modalShow="true" />
                                </Row>
                                <Alert type="error" v-show="erro === 2" style="margin-left: 39px">{{ this.errotext }}</Alert>

                                <FormItem>
                                    <Checkbox v-model="readUserAgree" @on-change="changeCheck">
                                        <span>我已阅读同意</span>
                                    </Checkbox>
                                    <div class="readUserAgree" style="display: inline" @click="biyes">《用户协议》</div>
                                </FormItem>
                                <FormItem>
                                    <Button :loading="loading" style="width: 30%" type="primary" @click.native="getList" size="large">获取个人信息</Button>
                                </FormItem>
                            </Form>
                        </div>
                        <div v-else-if="isShow == 1" class="leftCon_contentDiv">
                            <Card>
                                <Col>
                                    <Form :model="form" label-position="right" :label-width="100">
                                        <Row style="width: 100%" v-for="(item, index) in studentInfo">
                                            <Col style="width: 80%; float: left">
                                                <FormItem :label="item.name" :prop="index" v-if="!item.isSelect">
                                                    <Input size="large" clearable disabled autocomplete="off" style="width: 100%" v-model="studentForm[index]" />
                                                </FormItem>
                                                <FormItem :label="item.name" :prop="index" v-if="item.isSelect">
                                                    <Select v-model="studentForm[index]" disabled>
                                                        <Option v-for="e in item.dict" :value="e.value">{{ e.title }}</Option>
                                                    </Select>
                                                </FormItem>
                                                <FormItem v-if="item.checkTrue && !item.isSelect">
                                                    <Input
                                                        size="large"
                                                        clearable
                                                        placeholder="请输入正确信息"
                                                        autocomplete="off"
                                                        style="width: 100%; z-index: 0; position: relative"
                                                        v-model="copyStudentForm[index]"
                                                    />
                                                </FormItem>

                                                <FormItem v-if="item.checkTrue && item.isSelect">
                                                    <Select v-model="copyStudentForm[index]" style="z-index: 1100; position: relative">
                                                        <Option v-for="e in item.dict" :value="e.value">{{ e.title }}</Option>
                                                    </Select>
                                                </FormItem>
                                            </Col>
                                            <!--                      <Col style="width: 15%;float: right" v-if="item.show">-->
                                            <!--                        <Checkbox v-model="item.checkTrue" @on-change="studentModify(index)">有误</Checkbox>-->
                                            <!--                      </Col>-->
                                        </Row>

                                        <!--                    <FormItem label="上传证明材料" :prop="zmcl">-->
                                        <!--                      <uploadFiles-->
                                        <!--                          @on-change="form.zmcl=$event"-->
                                        <!--                          ref="fileUrlUploadFiles"-->
                                        <!--                          :format="['jpg','pdf','png','jpeg','gif','bmp','tiff']"-->
                                        <!--                          :fileNumber="1"-->
                                        <!--                          :multiple="true"-->
                                        <!--                          :max-size="5"-->
                                        <!--                      ></uploadFiles>-->
                                        <!--                    </FormItem>-->

                                        <FormItem>
                                            <Button :loading="loading" style="width: 30%" type="primary" @click.native="clickStudentInfo" size="large">确认</Button>
                                        </FormItem>
                                    </Form>
                                </Col>
                            </Card>
                        </div>
                        <div v-else-if="isShow == 2" class="leftCon_contentDiv">
                            <Form :model="formPwd" ref="formPwd" :rules="rulesFormPwd" :label-width="80">
                                <FormItem label="出生时间" prop="cssj">
                                    <DatePicker
                                        v-model="formPwd.cssj"
                                        type="datetime"
                                        format="yyyy-MM-dd"
                                        clearable
                                        @on-change="selectCssj"
                                        placeholder="请选择出生日期"
                                        style="width: 100%"
                                    ></DatePicker>
                                </FormItem>
                                <!--                <FormItem label="手机号码" prop="mobile">-->
                                <!--                  <Input size="large"-->
                                <!--                         clearable-->
                                <!--                         disabled-->
                                <!--                         autocomplete="off" style="width: 100%" v-model="formPwd.mobile"/>-->
                                <!--                </FormItem>-->
                                <FormItem label="电子邮箱" prop="email">
                                    <Input size="large" clearable autocomplete="off" style="width: 100%" v-model="formPwd.email" />
                                </FormItem>
                                <FormItem label="QQ号码" prop="qq">
                                    <Input size="large" clearable autocomplete="off" style="width: 100%" v-model="formPwd.qq" />
                                </FormItem>
                                <FormItem label="所在地区" prop="szdq">
                                    <Select maxlength="100" v-model="formPwd.szdq" filterable clearable>
                                        <Option v-for="item in jtdzCodeList" :value="item.code">{{ item.displayName }}</Option>
                                    </Select>
                                </FormItem>
                                <FormItem label="家庭地址" prop="jtdz">
                                    <Input size="large" clearable autocomplete="off" style="width: 100%" v-model="formPwd.jtdz" />
                                </FormItem>
                                <FormItem label="家庭电话" prop="jtdh">
                                    <Input size="large" clearable autocomplete="off" style="width: 100%" v-model="formPwd.jtdh" />
                                </FormItem>
                                <FormItem label="家庭邮编" prop="jtyb">
                                    <Input size="large" clearable autocomplete="off" style="width: 100%" v-model="formPwd.jtyb" />
                                </FormItem>
                                <FormItem label="新密码" prop="password">
                                    <SetPassword size="large" v-model="formPwd.password" @on-change="changeInputPass" />
                                </FormItem>
                                <FormItem label="确认密码" prop="copyPwd">
                                    <SetPassword size="large" v-model="formPwd.copyPwd" @on-change="changeInputPass" />
                                </FormItem>
                                <FormItem>
                                    <Button :loading="loading" style="width: 30%" type="primary" @click.native="clickPwd" size="large">确认</Button>
                                </FormItem>
                            </Form>
                        </div>
                        <div v-else-if="3" class="leftCon_contentDiv">
                            <div class="leftCon_contentDiv_con">
                                <Icon type="md-checkmark-circle" />
                            </div>
                            <h2 class="leftCon_contentDiv_con">您提交的信息已发送到管理员，并且您已经成功激活账号</h2>
                            <div class="leftCon_contentDiv_con">{{ count }}秒后自动跳转</div>
                            <div class="leftCon_contentDiv_con">
                                <Button :loading="loading" style="width: 30%" type="primary" @click.native="goLogin" size="large">立即登录</Button>
                            </div>
                        </div>
                    </div>
                </div>

                <Modal width="80%" v-model="modal" :mask-closable="false" title="用户协议" @on-ok="ok" @on-cancel="cancel">
                    <agreement />
                </Modal>

                <div class="rightCon">
                    <div>注册须知：</div>
                    <div>
                        1.学生的基础信息依据个人的基础信息生成，第一次使用本系统时需填写个人的学校、毕业年度、身份证号、手机号等信息进行验证，如验证不通过，请联系学校核对相关信息并及时上报教育部；
                    </div>
                    <!--          <div>-->
                    <!--            2.验证通过后，请核对个人信息是否准确，如不准确请进行标记，填写正确信息，上传相应的证明材料，并提交学校审核；-->
                    <!--          </div>-->
                    <div>2.手机号、邮箱等将用于激活、密码找回等环节的验证码接收，请确保真实有效。</div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import { vaptchaID, vaptchaOffline, sendResetSms, resetByMobile, sendResetEmail, resetByEmail, deleteAllRedis, sendActivationCode } from '@/api/index';
import CountDownButton from '@/views/my-components/xboot/count-down-button';
//滑动验证码
import slidingVerification from '@/views/my-components/xboot/sliding-verification.vue';
import { validateMobile, validatePassword, changeList } from '@/libs/validate';
import { statusMember } from '@/api/app';
import uploadFiles from '@/views/my-components/xboot/upload-file';
import SetPassword from '@/views/my-components/xboot/set-password';
import { getDictDataByType } from '@/api/index.js';
import { getAllCollege, getAllYxManageList } from '@/api/bys/yx/yx.js';
import { postBodyRequest } from '@/libs/axios';
import agreement from './agreement';

export default {
    name: 'activation',
    data() {
        return {
            jtdzCodeList: [],
            loading: false, //提交按钮加载
            isShow: 0, //模块
            // 个人信息表单
            form: {
                token: '',
                school: '',
                idCard: '',
                bynx: '',
                mobile: '',
                code: ''
            },
            rulesForm: {
                school: [
                    {
                        required: true,
                        message: '学校选择不能为空',
                        trigger: 'change'
                    }
                ],
                bynx: [
                    {
                        required: true,
                        message: '不能为空',
                        trigger: 'change'
                    }
                ],
                idCard: [
                    {
                        required: true,
                        message: '身份证号不能为空',
                        trigger: 'blur'
                    }
                ],
                mobile: [
                    {
                        required: true,
                        message: '手机号不能为空',
                        trigger: 'blur'
                    },
                    {
                        validator: validateMobile,
                        trigger: 'change'
                    }
                ],
                code: [
                    {
                        required: true,
                        message: '验证码不能为空',
                        trigger: 'blur'
                    }
                ]
            },
            // 阅读同意
            readUserAgree: false,

            // 确认信息
            studentInfo: {
                // name 、show| 是否有误是否显示 、checkTrue|勾选有误判断、
                jb: { name: '届别', value: 'jb', show: true, checkTrue: false, isSelect: true, dict: [] },
                // yxdm: {name: '院校代码', show: true, checkTrue: false, isSelect:true, dict:[]},
                yxmc: { name: '院系名称', value: 'yxmc', show: true, checkTrue: false, isSelect: false, dict: [] },
                // xy: {name: '学院', show: true, checkTrue: false, isSelect:true, dict:[]},
                xh: { name: '学号', value: 'xh', show: true, checkTrue: false, isSelect: false, dict: [] },
                name: { name: '姓名', value: 'name', show: true, checkTrue: false, isSelect: false, dict: [] },
                idCard: { name: '身份证号', value: 'idCard', show: true, checkTrue: false, isSelect: false, dict: [] },
                sexCode: { name: '性别', value: 'sexCode', show: true, checkTrue: false, isSelect: true, dict: [] },
                mzCode: { name: '民族', value: 'mzCode', show: true, checkTrue: false, isSelect: true, dict: [] },
                zzmmCode: { name: '政治面貌', value: 'zzmmCode', show: true, checkTrue: false, isSelect: true, dict: [] },
                xlCode: { name: '学历', value: 'xlCode', show: true, checkTrue: false, isSelect: true, dict: [] },
                xxxs: { name: '学习形式', value: 'xxxs', show: true, checkTrue: false, isSelect: true, dict: [] },
                zyCode: { name: '专业', value: 'zyCode', show: true, checkTrue: false, isSelect: false, dict: [] },
                zyfx: { name: '专业方向', value: 'zyfx', show: true, checkTrue: false, isSelect: false, dict: [] },
                pyfsCode: { name: '培养方式', value: 'pyfsCode', show: true, checkTrue: false, isSelect: true, dict: [] },
                dxhwpdw: { name: '定向或委培单位', value: 'dxhwpdw', show: true, checkTrue: false, isSelect: false, dict: [] },
                sydCode: { name: '生源所在地', value: 'sydCode', show: true, checkTrue: false, isSelect: true, dict: [] },
                cxsy: { name: '城乡生源', value: 'cxsy', show: true, checkTrue: false, isSelect: false, dict: [] },
                xz: { name: '学制', value: 'xz', show: true, checkTrue: false, isSelect: true, dict: [] },
                rxsj: { name: '入学时间', value: 'rxsj', show: true, checkTrue: false, isSelect: false, dict: [] },
                bysj: { name: '毕业时间', value: 'bysj', show: true, checkTrue: false, isSelect: false, dict: [] },
                sfslbCode: { name: '师范生类别', value: 'sfslbCode', show: true, checkTrue: false, isSelect: true, dict: [] },
                // szyx: {name: '所在院系', show: true, checkTrue: false, isSelect:true, dict:[]},
                szbj: { name: '所在班级', value: 'szbj', show: true, checkTrue: false, isSelect: false, dict: [] },
                // cssj: {name: '出生时间', show: true, checkTrue: false, isSelect:false, dict:[]},
                // rxqdaszdw: {name: '入学前档案所在单位', value: 'rxqdaszdw', show: true, checkTrue: false, isSelect:false, dict:[]},
                // dasfzrxx: {name: '档案是否转入学校', value: 'dasfzrxx', show: true, checkTrue: false, isSelect:true, dict:[]},
                // rxqhkszdpcs: {name: '入学前户口所在地派出所', value: 'rxqhkszdpcs', show: true, checkTrue: false, isSelect:false, dict:[]},
                // hksfzrxx: {name: '户口是否转入学校', value: 'hksfzrxx', show: true, checkTrue: false, isSelect:true, dict:[]},
                // mobile: {name: '手机号码', show: true, checkTrue: false, isSelect:false, dict:[]},
                // email: {name: '电子邮箱', show: true, checkTrue: false, isSelect:false, dict:[]},
                // qq: {name: 'QQ号码', show: true, checkTrue: false, isSelect:false, dict:[]},
                // jtdz: {name: '家庭地址', show: true, checkTrue: false, isSelect:false, dict:[]},
                // jtdh: {name: '家庭电话', show: true, checkTrue: false, isSelect:false, dict:[]},
                // jtyb: {name: '家庭邮编', show: true, checkTrue: false, isSelect:false, dict:[]},
                fxmc: { name: '分校名称', value: 'fxmc', show: true, checkTrue: false, isSelect: false, dict: [] }
            },
            studentForm: {
                jb: '',
                // yxdm: '',
                yxmc: '',
                // xy: '',
                xh: '',
                name: '',
                idCard: '',
                sexCode: '',
                mzCode: '',
                zzmmCode: '',
                xlCode: '',
                xxxs: '',
                zyCode: '',
                zyfx: '',
                pyfsCode: '',
                dxhwpdw: '',
                sydCode: '',
                cxsy: '',
                xz: '',
                rxsj: '',
                bysj: '',
                sfslbCode: '',
                // szyx: '',
                szbj: '',
                // cssj: '',
                // rxqdaszdw: '',
                // dasfzrxx: '',
                // rxqhkszdpcs: '',
                // hksfzrxx: '',
                // mobile: '',
                // email: '',
                // qq: '',
                // jtdz: '',
                // jtdh: '',
                // jtyb: '',
                fxmc: '',
                zmcl: ''
            },
            copyStudentForm: {
                jb: '',
                // yxdm: '',
                yxmc: '',
                // xy: '',
                xh: '',
                name: '',
                idCard: '',
                sexCode: '',
                mzCode: '',
                zzmmCode: '',
                xlCode: '',
                xxxs: '',
                zyCode: '',
                zyfx: '',
                pyfsCode: '',
                dxhwpdw: '',
                sydCode: '',
                cxsy: '',
                xz: '',
                rxsj: '',
                bysj: '',
                sfslbCode: '',
                // szyx: '',
                szbj: '',
                // cssj: '',
                // rxqdaszdw: '',
                // dasfzrxx: '',
                // rxqhkszdpcs: '',
                // hksfzrxx: '',
                // mobile: '',
                // email: '',
                // qq: '',
                // jtdz: '',
                // jtdh: '',
                // jtyb: '',
                fxmc: '',
                zmcl: ''
            },

            errorMobile: '',
            schoolList: [],
            bynxList: [],
            sending: false,
            getSms: '获取验证码',
            vaptchaObject: null,
            info: true,
            formPerson: [],
            formValidate: {},
            //   修改密码
            formPwd: {
                personId: '',
                password: '',
                copyPwd: '',
                passStrength: '',
                cssj: '',
                mobile: '',
                email: '',
                qq: '',
                szdq: '',
                jtdz: '',
                jtdh: '',
                jtyb: ''
            },
            rulesFormPwd: {
                password: [
                    {
                        required: true,
                        message: '请输入密码',
                        trigger: 'blur'
                    },
                    {
                        validator: validatePassword,
                        trigger: 'blur'
                    }
                ],
                copyPwd: [
                    {
                        required: true,
                        message: '请输入密码',
                        trigger: 'blur'
                    },
                    {
                        validator: validatePassword,
                        trigger: 'blur'
                    }
                ],
                mobile: [
                    { required: true, message: '请输入手机号', trigger: 'blur' },
                    { validator: validateMobile, trigger: 'change' }
                ],
                cssj: [{ required: true, message: '请输入出生时间', trigger: 'blur' }],
                email: [
                    { required: true, message: '请输入邮箱', trigger: 'blur' },
                    { type: 'email', message: '邮箱格式不正确' },
                    { max: 40, message: '邮箱不能超过40个字符', trigger: 'blur' }
                ],
                jtdz: [{ required: true, message: '请输入家庭地址', trigger: 'blur' }],
                szdq: [{ required: true, message: '请输选择所在地区', trigger: 'blur' }],
                qq: [{ max: 15, message: 'QQ号码不能超过15个字符', trigger: 'blur' }],
                jtdh: [
                    { required: true, message: '请输入家庭电话', trigger: 'blur' },
                    { max: 20, message: '家庭电话不能超过20个字符', trigger: 'blur' }
                ],
                jtyb: [
                    { required: true, message: '请输入家庭邮编', trigger: 'blur' },
                    { max: 10, message: '家庭邮编长度不能超过6个字符', trigger: 'blur' }
                ]
            },
            count: 3,
            modal: false,
            erro: 0,
            errotext: '',
            infoFixVo: []
        };
    },
    watch: {
        isShow(newVal, oldVal) {
            if (newVal == 3) {
                let timer = setInterval(() => {
                    this.count--;
                    if (this.count === 0) {
                        clearInterval(timer);
                        this.$router.push('/login');
                    }
                }, 1000);
            }
        }
    },
    components: {
        CountDownButton,
        SetPassword,
        slidingVerification,
        uploadFiles,
        agreement
    },
    mounted() {
        // this.initVaptcha()
        this.genYear();
        this.getSchoolList();
        this.getDictData();
    },
    methods: {
        ok() {
            this.$Message.success('已看过了');
        },
        cancel() {
            this.$Message.warning('没看完');
        },
        biyes() {
            // this.modal = true
            window.open('/agreement', '_blank');
            // this.$router.push('/agreement')
        },

        selectList(e) {
            this.form.bynx = e;
        },
        showVaptcha() {
            this.erro = 0;
            var reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
            if (!reg.test(this.form.mobile)) {
                this.errorMobile = '手机号格式错误';
                return;
            } else {
                this.errorMobile = '';
                this.sendSmsCode();
            }
            // this.vaptchaObject.validate(); // 若没验证验证码 开始验证
        },
        sendSmsCode() {
            this.$refs.slidingv.openModal();
        },
        onOk() {
            this.sending = true;
            this.getSms = '发送中';
            let obj = {
                mobile: this.form.mobile,
                school: this.form.school,
                bynx: new Date(this.form.bynx).getFullYear(),
                idCard: this.form.idCard
            };
            sendActivationCode(obj).then(res => {
                this.getSms = '获取验证码';
                this.sending = false;
                // this.vaptchaObject.reset();
                if (res.result.code === 200) {
                    // this.$refs.fileUrlUploadFiles.setData();
                    this.$Message.success('发送短信验证码成功');
                    // 开始倒计时
                    this.$refs.countDown.startCountDown();
                } else {
                    // this.$Message.error("未查询到您的学籍信息，请检查输入的信息是否正确，如果正确请联系学校就业部门！");
                    this.erro = 2;
                    this.errotext = res.result.message;
                }
            });
        },
        // 勾选同意书
        changeCheck(e) {
            this.readUserAgree = e;
        },
        //获取个人信息
        async getList() {
            console.log(this.form);
            if (this.readUserAgree) {
                this.$refs.form.validate(valid => {
                    if (valid) {
                        this.loading = true;
                        this.postRequest('/bysPersonInfo/getInfoForActivate', this.form).then(res => {
                            if (res.success) {
                                //
                                this.loading = false;
                                this.studentForm = res.result;
                                this.studentForm.zyCode = res.result.zy;
                                // 第三步数据回显
                                this.formPwd.cssj = res.result.cssj;
                                this.formPwd.email = res.result.email;
                                this.formPwd.qq = res.result.qq;
                                this.formPwd.szdq = res.result.szdq;
                                this.formPwd.jtdz = res.result.jtdz;
                                this.formPwd.jtdh = res.result.jtdh;
                                this.formPwd.jtyb = res.result.jtyb;
                                this.formPwd.mobile = this.form.mobile;
                                this.isShow = '1';
                            } else {
                                this.loading = false;
                            }
                        });
                    }
                });
            } else {
                // this.$Message.error('请勾选服务协议！');
                this.$Message.error({
                    duration: 5,
                    content: '请勾选服务协议！',
                    closable: true
                });
            }
        },
        //   个人信息有误点击修改
        studentModify(e) {
            this.studentInfo[e].copyInp = !this.studentInfo[e].copyInp;
        },
        // 确认信息
        clickStudentInfo() {
            this.isShow = '2';
            /*      this.infoFixVo = []
      this.$Modal.confirm({
        title: "确认提交",
        content: "确认个人信息提交！",
        onOk: () => {
          let hasCheck = false
          this.infoFixVo = []
          for (let key in this.studentInfo) {
            //只要勾选一个就可以提交
            if (this.studentInfo[key].checkTrue) {
              hasCheck = true
              let infoFix = {
                personInfoId: this.studentForm.id,
                errorColumnName: this.studentInfo[key].name,
                errorColumn: this.studentInfo[key].value,
                oldValue: this.studentForm[key],
                newValue: this.copyStudentForm[key],
                zmcl: this.form.zmcl,
                isSelect: this.studentInfo[key].isSelect
              }
              this.infoFixVo.push(infoFix)
            }

          }
          if (!hasCheck){
            this.isShow = '2';
            return;
          }
          if (this.infoFixVo.length !== 0 && this.form.zmcl === ''){
            this.$Message.info("请上传证明材料！")
            return
          }
          this.loading = true
          postBodyRequest("/bysPersonInfo/updateInfoForActivate", this.infoFixVo).then(res => {
            this.loading = false
            if (res.success) {
              this.$Message.success("操作成功");
              this.isShow = '2'
            }
          });
        },
      });*/
        },
        //   个人信息确认
        clickTrue() {
            this.$Modal.confirm({
                title: '确认个人信息是否正确并提交？',
                onOk: () => {
                    // statusMember({ userId: v.id, enable }).then((res) => {
                    //   this.$Modal.remove();
                    //   if (res.success) {
                    //     this.$Message.success("操作成功");
                    //     this.getDataList();
                    //   }
                    // });
                }
            });
        },
        //   修改密码确认
        clickPwd() {
            let { password, copyPwd } = this.formPwd;
            if (this.formPwd.password === this.formPwd.copyPwd) {
                this.$refs.formPwd.validate(valid => {
                    if (valid) {
                        this.formPwd.personId = this.studentForm.id;
                        this.loading = true;
                        this.postRequest('/bysPersonInfo/insertUserInfoForActivate', this.formPwd).then(res => {
                            this.loading = false;
                            if (res.success) {
                                this.$Message.info('修改成功');
                                this.isShow = '3';
                            }
                        });
                    }
                });
            } else {
                // this.$Message.error('两次密码不一致！')
                this.$Message.error({
                    content: '两次密码不一致！',
                    duration: 5,
                    closable: true
                });
            }
        },
        //
        changeInputPass(v, grade, strength) {
            this.formPwd.passStrength = strength;
        },
        //   立即登录
        goLogin() {
            this.$router.push('/login');
        },
        // 生成年份
        genYear() {
            const currentYear = new Date().getFullYear() + 1;
            for (let i = 0; i < 20; i++) {
                this.bynxList.push(String(currentYear - i));
            }
        },
        datapick(e) {
            this.form.bynx = e;
        },
        getSchoolList() {
            this.loading = true;
            this.postRequest('/schoolCode/getAll').then(res => {
                if (res.success) {
                    this.loading = false;
                    this.schoolList = res.result;
                    // this.studentInfo.yxdm.dict = res.result.map(e => {
                    //   return {title: e.name,value: e.code}
                    // })
                }
            });
        },
        handleBeforeUpload(file) {
            const fileExt = file.name.split('.').pop().toLocaleLowerCase();
            if (fileExt === 'pdf' || fileExt === 'jpg') {
                return true;
            }
            return false;
        },
        getDictData() {
            // 单位所在地->取自数据库地区代码
            this.postRequest('/areaCode/getAll').then(res => {
                if (res.success) {
                    this.jtdzCodeList = res.result;
                    this.studentInfo.sydCode.dict = res.result;
                }
            });
            //界别
            this.studentInfo.jb.dict = this.bynxList.map(e => {
                return { title: e + '届', value: e };
            });
            // // 高校代码
            // this.postRequest("/schoolCode/getAll").then(res => {
            //   if (res.success){
            //     this.studentInfo.yxdm.dict = res.result.map(e => {
            //       return {title: e.name,value: e.code}
            //     })
            //   }
            // })
            // 院系代码

            //性别
            getDictDataByType('sex').then(res => {
                if (res.success) {
                    this.studentInfo.sexCode.dict = res.result;
                }
            });
            //民族
            getDictDataByType('ethnic').then(res => {
                if (res.success) {
                    this.studentInfo.mzCode.dict = res.result;
                }
            });
            //政治面貌
            getDictDataByType('political').then(res => {
                if (res.success) {
                    this.studentInfo.zzmmCode.dict = res.result;
                }
            });
            //学历代码
            getDictDataByType('degree').then(res => {
                if (res.success) {
                    this.studentInfo.xlCode.dict = res.result;
                }
            });
            //学习形式
            getDictDataByType('learning-forms').then(res => {
                if (res.success) {
                    this.studentInfo.xxxs.dict = res.result;
                }
            });
            //培养方式
            getDictDataByType('training-methods').then(res => {
                if (res.success) {
                    this.studentInfo.pyfsCode.dict = res.result;
                }
            });
            //学制
            getDictDataByType('educational-system').then(res => {
                if (res.success) {
                    this.studentInfo.xz.dict = res.result;
                }
            });

            //师范生类别代码
            getDictDataByType('sfs_type').then(res => {
                if (res.success) {
                    this.studentInfo.sfslbCode.dict = res.result;
                }
            });

            //学习形式
            getDictDataByType('learning-forms').then(res => {
                if (res.success) {
                    this.studentInfo.xxxs.dict = res.result;
                }
            });
        },
        selectCssj(v) {
            if (v) {
                this.formPwd.cssj = v;
            }
        }
    }
};
</script>

<style scoped lang="less">
@import './activation.less';
</style>
